/**
 * Captain
 * © 2018 Captain copyright，All rights reserved.
 * http://www.sccaptain.com.cn
 * 
 * JAVA : 8
 * 文  件  名: AdminServiceImpl.java
 * 创  建  人: QinYoubin (qin.youbin@sccaptain.com.cn)
 * 创建时间: 2018年4月26日 下午3:43:16
 * 版         本: 1.0.0
 * 备         注:
 * 修订历史:
 */
package com.material.c2c.user.service;

import java.util.List;

import javax.annotation.Resource;
import javax.transaction.Transactional;

import org.springframework.stereotype.Service;

import com.cpt.framework.core.OperationResult;
import com.material.c2c.core.UUIDGenerator;
import com.material.c2c.user.dao.AdressDao;
import com.material.c2c.user.entity.SHDZ;

/**
 * 地址管理
 * @since 1.0
 * @version 1.0
 * @author QinYoubin (qin.youbin@sccaptain.com.cn)
 */
@Service
public class AdressServiceImpl implements AdressService{
  @Resource
  private AdressDao adressDao;
  @Override
  @Transactional
  public OperationResult add(SHDZ shdz) {
	  shdz.setId(UUIDGenerator.generateUUIDStr());
    shdz  = adressDao.add(shdz);
    if(shdz == null) {
      return OperationResult.failed("添加出错！");
    }
    return OperationResult.SUCCEED;
  }
  @Override
  @Transactional
  public OperationResult update(SHDZ shdz) {
    shdz = adressDao.update(shdz);
    if(shdz == null) {
      return OperationResult.failed("添加出错！");
    }
    return OperationResult.SUCCEED;
  }
  
  @Override
  @Transactional
  public OperationResult delete(String id) {
    adressDao.delete(id);
    return OperationResult.SUCCEED;
  }
  @Override
  public SHDZ getOne(String id) {
    return adressDao.getOne(id);
  }
  @Override
  public List<SHDZ> search(String id){
    return adressDao.findByYhid(id);
  }
}
